package com.rs.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.rs.dao.ZhClassesMapper;
import com.rs.dao.ZhLeanprogressMapper;
import com.rs.model.CommonResult;
import com.rs.model.ZhClasses;
import com.rs.model.ZhLeanprogress;
import com.rs.service.ZhLeanprogressService;

@Service
public class ZhLeanprogressServiceImpl implements ZhLeanprogressService {
	
	@Autowired
	private  ZhClassesMapper zhClassesMapper;
	
	@Autowired
	private  ZhLeanprogressMapper zhLeanprogressMapper;

	@Override
	public CommonResult<Integer> updateTeachingProgress(ZhClasses record) {
		// TODO Auto-generated method stub
		int state = zhClassesMapper.updateTeachingProgress(record);
		if(state==0){
			return new CommonResult<Integer>(200, "修改失败");
		}
		return  new CommonResult<Integer>(200, "修改成功");
	}

	@Override
	public ZhLeanprogress selectTeachingProgress(Integer ClId) {
		// TODO Auto-generated method stub
		return zhLeanprogressMapper.selectTeachingProgress(ClId);
	}

	@Override
	public Page<ZhLeanprogress> slecteLeanprogressesAllLeanprogresses(Integer Pagernunm,
			ZhLeanprogress zhLeanprogressService) {
		//用插件进行分页
        PageHelper.startPage(Pagernunm, 10);// 参数： 页数   条数
		return zhLeanprogressMapper.slecteLeanprogressesAllLeanprogresses(zhLeanprogressService);//调用mapper无需多说
	}

	@Override
	public int UpdateZhLean(ZhLeanprogress record) {
		return zhLeanprogressMapper.updateByPrimaryKeySelective(record);
		
	}


	@Override
	public int deleteByPrimaryKey(Integer lpgId) {
		// TODO Auto-generated method stub
		return zhLeanprogressMapper.deleteByPrimaryKey(lpgId);
	}

	@Override
	public int insertSelective(ZhLeanprogress record) {
		// TODO Auto-generated method stub
		return zhLeanprogressMapper.insertSelective(record);
	}

	@Override
	public Page<ZhLeanprogress> selectZhLeanprogress(ZhLeanprogress record) {
		// TODO Auto-generated method stub
		return zhLeanprogressMapper.selectZhLeanprogress(record);
	}

	@Override
	public ZhLeanprogress selectZhLean(Integer lpgId) {
		// TODO Auto-generated method stub
		return zhLeanprogressMapper.selectZhLean(lpgId);
	}
}
